package com.itheima.mapper;

import com.itheima.pojo.Brand;
import org.apache.ibatis.annotations.*;

import java.util.List;

public interface BrandMapper {
    //查询方法
    @Select("select * from tb_brand order by ordered asc")
    @ResultMap("brandResultMap")
    List<Brand> selectAll();

    @Insert("insert into tb_brand values(null,#{brandName},#{companyName},#{ordered},#{description},#{status})")
    void addBrand(Brand brand);

    @Select("Select * from tb_brand where id = #{id}")
    @ResultMap("brandResultMap")
    Brand selectBrand(int id);

    @Update("update tb_brand set brand_name = #{brandName},ordered = #{ordered},description = #{description},status = #{status} where id = #{id}")
    @ResultMap("brandResultMap")
    void updateBrand(Brand brand);

    @Delete("delete from tb_brand where id = #{id}")
    void deleteBrand(int id);
}
